package com.example.homework.api

import com.example.homework.utils.CONSTANTS.Companion.API
import com.example.homework.utils.CONSTANTS.Companion.BASE_URL
import com.example.homework.models.PhotosModel
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query

object MarsPhotosApi {
    private val retrofit: Retrofit =
        Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(MoshiConverterFactory.create())
            .build()
    val getPhotosApi: GetPhotosApi = retrofit.create(GetPhotosApi::class.java)
}

interface GetPhotosApi {
    @GET("rovers/curiosity/photos")
    suspend fun getPhotos(
        @Query("sol") sol: Int = 1000,
        @Query("page") page:Int = 0,
        @Query("api_key") api: String = API
    ): PhotosModel
}